package com.chinadci.smartcommunitysystembackstage.mapper;

import com.chinadci.smartcommunitysystembackstage.entity.ScsComplaint;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinadci.smartcommunitysystembackstage.entity.ScsPay;
import com.chinadci.smartcommunitysystembackstage.entity.ScsPayType;
import com.chinadci.smartcommunitysystembackstage.entity.ScsUser;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Code Duck
 * @since 2021-04-13
 */
public interface ScsComplaintMapper extends BaseMapper<ScsComplaint> {
    //显示所有投诉列表
    @Select("select * from scs_complaint")
    @Results({
            @Result(id = true,column = "c_id",property = "cId"),
            @Result(column = "c_type",property = "cType"),
            @Result(column = "c_info",property = "cInfo"),
            @Result(column = "c_time",property = "cTime"),
            @Result(column = "c_anonymous",property = "cAnonymous"),
            @Result(column = "c_state",property = "cState"),
            @Result(column = "u_id",property = "user", javaType =com.chinadci.smartcommunitysystembackstage.entity.ScsUser.class,one = @One(select = "Select"))
    })
    List<ScsComplaint> Find();

    @Select("select * from scs_user where u_id=#{u_id}")
    List<ScsUser> Select(int id);

    //根据投诉时间显示所有投诉列表
    @Select("select * from scs_complaint where c_time=#{time}")
    @Results({
            @Result(id = true,column = "c_id",property = "cId"),
            @Result(column = "c_type",property = "cType"),
            @Result(column = "c_info",property = "cInfo"),
            @Result(column = "c_time",property = "cTime"),
            @Result(column = "c_anonymous",property = "cAnonymous"),
            @Result(column = "c_state",property = "cState"),
            @Result(column = "u_id",property = "user", javaType =com.chinadci.smartcommunitysystembackstage.entity.ScsUser.class,one = @One(select = "Select"))
    })
    List<ScsComplaint> Finds(String time);

}
